package com.itheima;

import java.util.Scanner;

public class HelloWorld {
    public static void main(String[] args) {
//        int i = 0;
//        System.out.println("HelloWorld");
//
//        Scanner sc = new Scanner(System.in);
//        System.out.println("请输入一个字符串：");
//        String inString = sc.nextLine();
//        System.out.println(inString);

        String username = "itheima";
        String password = "123";

        for (int i = 0; i < 3; i++) {
            Scanner sc = new Scanner(System.in);
            System.out.println("请输入用户名：");
            String name = sc.nextLine();
            System.out.println("请输入密码：");
            String pwd = sc.nextLine();

            if (name.equals(username) && pwd.equals(password)) {
                System.out.println("登录成功");
                break;
            } else {
                if (2 - i == 0) {
                    System.out.println("您的账户被锁定，请与管理员联系。");
                } else {
                    System.out.println("登录失败，您还有" + (2 - i) + "次机会");
                }
            }
        }
    }
}